<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>Client Side Pagination in DataGrid - jQuery EasyUI Demo</title>

</head>
<body>
	<table style="padding:10px">
		<tr>
			<td >数量：</td>
			<td colSpan="2"><input id="count2" class="easyui-textbox" value="1" data-options="required:true" style="width: 260px" ></td>
		</tr>
		<tr>
			<td >子域个数：</td>
			<td colSpan="2"><input id="userDomainCnt" class="easyui-textbox" value="1" data-options="required:true" style="width: 260px" ></td>
		</tr>
		<tr>
			<td >生效时间：</td>
			<td colSpan="2"><input id="startDt" class="easyui-datebox" data-options="formatter:myformatter" style="width: 260px" ></td>
		</tr>
		<tr>
			<td >失效时间：</td>
			<td colSpan="2"><input id="endDt" class="easyui-datebox"  data-options="formatter:myformatter" style="width: 260px" ></td>
		</tr>
		<tr>
			<td colspan="3" align="right">
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">确认</a>
				<a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">取消</a>
			</td>
		</tr>
	</table>
	<script type="text/javascript" th:inline="none">
	
		function myformatter(date){
			var y = date.getFullYear();
			var m = date.getMonth()+1;
			var d = date.getDate();
			return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
		}

		function submitForm(){
			var count2 = $('#count2').val();
			var startDt = $('#startDt').val();
			var endDt = $('#endDt').val();
			var userDomainCnt = $('#userDomainCnt').val();
			console.log('info:'+count2+","+startDt+","+endDt);
			
			if(count2==''){
		      	$.messager.show({
					title:'错误',
					msg: '参数不足',
					timeout:2000,
					showType:'slide'
				});
		      	$('#dlg7').dialog('close');
				return;
			}

			$.ajax({
			    type : "POST", 
			    url : "/massCreateInviteCd",
			    data : { "count": count2, "startDt": startDt, "endDt": endDt, "userDomainCnt":userDomainCnt },
			    success : function(result) {
			      	$.messager.show({
						title:'结果',
						msg: result,
						timeout:2000,
						showType:'slide'
					});
			      	$('#tb7').datagrid('reload');
				},
				error : function(){
			       	$.messager.show({
						title:'失败',
						msg:'创建邀请码失败',
						timeout:2000,
						showType:'slide'
					}); 
				}
			});
			
			$('#dlg7').dialog('close');
		}
		function clearForm(){
			$('#dlg7').dialog('close');
		}
		
	</script>
	
</body>
</html>
